﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SqlDataTypes
{
    public class SqlNvarchar:SqlDataType
    {
        private const int MAXSIZE = 4000;
        private const int MINSIZE = 1;
        private int size;
        private string name;
        private string sqlQuery;

        public SqlNvarchar()
        {
            size = MAXSIZE;
            name = "nvarchar";
            sqlQuery = GetSqlQuery();
        }
        private string GetSqlQuery()
        {
            return name + "(" + size.ToString() + ")";
        }

        public override string Name
        {
            get { return name; }
        }

        public override string SqlCommand
        {
            get { return sqlQuery; }
        }

        private int Size
        {
            set
            {
                if (value > MAXSIZE)
                {
                    size = MAXSIZE;
                }
                else if (value < MINSIZE)
                {
                    size = MINSIZE;
                }
                else
                {
                    size = value;
                }
            }
        }
    }
}
